package com.example.todofinally;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.todofinally.adaoter.ListAdapter;
import com.example.todofinally.sql.Data;
import com.example.todofinally.sql.SpHelper;

import java.util.List;

public class ListActivity extends AppCompatActivity {
    private List<Data> list;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);


        RecyclerView rv_list = findViewById(R.id.rv_list);
        rv_list.setLayoutManager(new LinearLayoutManager(ListActivity.this));
        SpHelper SpHelper=new SpHelper(ListActivity.this);
        list = SpHelper.query2();
        rv_list.setAdapter(new ListAdapter(ListActivity.this,list));
    }

    @Override
    protected void onResume() {
        super.onResume();
        RecyclerView rv_list = findViewById(R.id.rv_list);
        rv_list.setLayoutManager(new LinearLayoutManager(ListActivity.this));
        SpHelper SpHelper=new SpHelper(ListActivity.this);
        list = SpHelper.query2();
        rv_list.setAdapter(new ListAdapter(ListActivity.this,list));
    }


/*    public void edit_longClick(View view) {
        Intent login = new Intent(this, edit_Activity.class);
        startActivity(login);
    }*/
}